*
* Table 6: Demographics, socioeconomic status, academic achievement and dominated choices
*
* Input table: 
*	"${data_applicant_level_tidy}"
*
* Output file: 
*	/results/Table6.tex
*

use "${data_applicant_level_tidy}", clear

* Restrict to the eligible sample
keep if eligibility == 1 & any_ba_listed == 1 & no_funded_version_at_all == 0

do "${helpers_dir}/addVariablesForRegressionAnalysis.do"

local demography female female_missing voc_school other_school countycapital town village i.year

qui reg dominated_choice unempl_rate unempl_missing GPA11_std GPA11_missing `demography', r
est store est_1

qui reg dominated_choice grossincome grossincome_missing GPA11_std GPA11_missing `demography', r
est store est_2

qui reg dominated_choice disadv GPA11_std GPA11_missing `demography', r
est store est_3

qui esttab est_1 est_2 est_3 ///
	using "${result_dir}/Table6.tex", ///
	drop(_cons *_missing) b(3) se(3) r2 indicate("Year FE = *year") ///
	stat(r2, fmt(%18.2g) ///
	labels("R-squared")) ///
	label star(* 0.10 ** 0.05 *** 0.01) replace noomitted nogaps f noobs ///
	nomtitles nonumbers nolines ///
	order(unempl_rate grossincome disadv GPA11_std voc_school other_school countycapital town village female)
	
* ------------------------------------------------------------------------------	
* Table notes:
qui sum GPA11_missing
di "Sample size: " r(N)
di "Eleventh-grade GPA is missing for " round(r(mean)*100) "% of the sample."

qui sum dominated_choice
di "The share of dominated choices is " round(r(mean)*100) "% in this subsample."
